<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    function request(url) {
        return new Promise((reslove, reject) => {
            let xhr = new XMLHttpRequest();
            xhr.open("get", url);
            xhr.send();
            xhr.onreadystatechange = () => {
                if (xhr.readyState === 4) {
                    reslove(JSON.parse(xhr.response))
                }
            }
        })
    }
    async function getmsg() {
        // await 等 后面pormise状态发生改变后才会执行下面代码
        let res = await request('./one.json');
        console.log(res)
        let data = await request("./two.json");
        console.log(data)
    }
    getmsg();
</script>

</html>